﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace Submarines
{
    class Computer : Board
    {
        Random r = new Random();

        protected override void OnMouseClick(object sender, MouseEventArgs e)
        {
            if ((e.Button & MouseButtons.Left) != MouseButtons.Left) return;

            Button button = ((Button)sender);
                
            if ((string)button.Tag == _Exists)
            {
                button.Tag = _Hit;
                button.BackColor = _HitColor;
            } else button.Visible = false;
        }

        //bool NewSubmarine(int size)
        //{
        //    bool vertical = (r.Next(0,2) == 1);
        //    int x = r.Next(0,10);
        //    int y = r.Next(0,10);

        //    if (SubmarineValid(x, y, size, vertical))
        //    {
        //        DrawSubmarine(x, y, size, vertical, _ExistColor);
        //        UpdateSubmarine(x, y, size, vertical, _Exists);
        //        InstallSubmarine(size);
        //        return true;
        //    }
        //    return false;            
        //}

        //public void InstallSubmarines()
        //{
        //    int g;
            
        //    InitializeSubmarines();
        //    for (int a = 1; a <= 4; a++)
        //        for (int b = a; b <= 4; b++)
        //            while (!NewSubmarine(a)) g=1;
        //}

        //public void Next()
        //{
        //    int x, y;
        //    do
        //    {
        //        x = r.Next(0, 10);
        //        y = r.Next(0, 10);
        //    }
        //    while (!TryHit(x, y));

        //}

        private void InitializeComponent()
        {
            this.SuspendLayout();
            // 
            // Computer
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.Name = "Computer";
            this.Size = new System.Drawing.Size(469, 474);
            //this.Load += new System.EventHandler(this.Computer_Load);
            this.ResumeLayout(false);

        }

      
    }
}
